#!/bin/bash

PACKAGE_PATH="$1"
INSTALL_PATH="$2"
INSTALL_VOLUME="$3"
SYSTEM_ROOT="$4"

# The purpose of the preflight script is to clean out the files of the old
# installation.

# Clean out legacy stuff.
rm -rf "${INSTALL_VOLUME}/System/Library/Filesystems/fusefs_txantfs.fs"
rm -rf "${INSTALL_VOLUME}/Library/Filesystems/fusefs_txantfs.fs"
rm -f "${INSTALL_VOLUME}/sbin/mount_fusefs_txantfs"
rm -f "${INSTALL_VOLUME}/sbin/newfs_fusefs_txantfs"

# Clean out directories included in current package.
rm -rf "${INSTALL_VOLUME}/System/Library/Filesystems/tuxera_ntfs.fs"
rm -rf "${INSTALL_VOLUME}/Library/Filesystems/tuxera_ntfs.fs"
rm -rf "${INSTALL_VOLUME}/Library/PreferencePanes/Tuxera NTFS.prefPane"

# If these operations fail, don't report any error. The installation is probably
# ok anyway.

exit 0
